package org.ly.uap.client.validation;

import java.beans.PropertyEditorSupport;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import org.ly.uap.client.util.CommonUtils;

public final class ProxyListEditor extends PropertyEditorSupport {
    public void setAsText(String text)
            throws IllegalArgumentException {
        BufferedReader reader = new BufferedReader(new StringReader(text));
        List proxyChains = new ArrayList();
        try {
            String line;
            while ((line = reader.readLine()) != null) {
                if (CommonUtils.isNotBlank(line))
                    proxyChains.add(line.trim().split(" "));
            }
        } catch (IOException localIOException) {
            try {
                reader.close();
            } catch (IOException localIOException1) {
            }
        } finally {
            try {
                reader.close();
            } catch (IOException localIOException2) {
            }
        }
        setValue(new ProxyList(proxyChains));
    }
}
